package cn.wolfcode.luowowo.website.util;

import cn.wolfcode.luowowo.cache.service.IUserInfoRedisService;
import cn.wolfcode.luowowo.member.domain.UserInfo;
import com.alibaba.dubbo.config.annotation.Reference;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class GettokenUtil {

    public static String getUser(HttpServletRequest request){
        //获取浏览器的cookie
        String token ="";
        Cookie[] cookies = request.getCookies();
        if(cookies!=null && cookies.length>0){
            for(Cookie cookie:cookies){
                if(cookie.getName().equals("token")){
                     token = cookie.getValue();
                   return token;
                }
            }
        }
        return null;
    }
}
